import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '',
      redirect: 'UserInfoLogin'
    },
    {
      path: '/UserInfoLogin',
      name: 'UserInfoLogin',
      component: () => import('../views/UserInfo/UserInfoLoginView.vue')
    },
    {
      path: '/AddUserInfo',
      name: 'AddUserInfo',
      component: () => import('../views/UserInfo/AddUserInfoView.vue')
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/Main',
      name: 'Main',
      component: () => import('../views/MainView.vue'),
      children: [
        {
          path: '/UserInfoList',
          name: 'UserInfoList',
          component: () => import('../views/UserInfo/UserInfoListView.vue')
        },
        {
          path: '/UpdateUserInfo',
          name: 'UpdateUserInfo',
          component: () => import('../views/UserInfo/UpdateUserInfoView.vue')
        },
        {
          path: '/AddRole',
          name: 'AddRole',
          component: () => import('../views/Roles/AddRoleView.vue')
        },
        {
          path: '/RoleList',
          name: 'RoleList',
          component: () => import('../views/Roles/RoleListView.vue')
        },
        {
          path: '/UpdateRole',
          name: 'UpdateRole',
          component: () => import('../views/Roles/UpdateRoleView.vue')
        },
        {
          path: '/AddMenu',
          name: 'AddMenu',
          component: () => import('../views/Menus/AddMenuView.vue')
        },
        {
          path: '/MenuList',
          name: 'MenuList',
          component: () => import('../views/Menus/MenuListView.vue')
        },
        {
          path: '/UpdateMenu',
          name: 'UpdateMenu',
          component: () => import('../views/Menus/UpdateMenuView.vue')
        },
        {
          path: '/RoleMenu',
          name: 'RoleMenu',
          component: () => import('../views/RoleMenus/RoelMenuView.vue')
        },
        {
          path: '/AddLeave',
          name: 'AddLeave',
          component: () => import('../views/RequestForLeave/AddLeaveView.vue')
        },
        {
          path: '/LeaveList',
          name: 'LeaveList',
          component: () => import('../views/RequestForLeave/LeaveListView.vue')
        },
        {
          path: '/ApproveLeave', //审批
          name: 'ApproveLeave',
          component: () => import('../views/RequestForLeave/ApproveView.vue')
        },
        {
          path: '/UpdateLeave', //修改
          name: 'UpdateLeave',
          component: () => import('../views/RequestForLeave/UpdateLeaveView.vue')
        },
        {
          path: '/ShoppingView', //溯源管理--商品信息
          name: 'ShoppingView',
          component: () => import('../views/Shopping/ShoppingView.vue')
        },
        {
          path: '/Detail', //溯源管理--详情信息
          name: 'Detail',
          component: () => import('../views/Details/DetailView.vue'),
          children: [
            {
              path: '/BreedView', //溯源管理-溯源详情-养殖信息
              name: 'BreedView',
              component: () => import('../views/Breed/BreedView.vue')
            },
            {
              path: '/Slaughter', //溯源管理-溯源详情-屠宰信息
              name: 'Slaughter',
              component: () => import('../views/Slaughter/SlaughterView.vue')
            },
            {
              path: '/DeepProcessing', //溯源管理-溯源详情-深加工信息
              name: 'DeepProcessing',
              component: () => import('../views/DeepProcessing/DeepProcessingView.vue')
            },
          ]
        },

      ]
    },
  ]
})

export default router
